package cs271.hw.liststackqueue;

import cs271.hw.liststackqueue.interfaces.SimpleStack;

public class SimpleStackImpl<T> implements SimpleStack<T> {
	
	private SinglyLinkedList<T> list = new SinglyLinkedList<T>();


	public T peek() {
		if (!isEmpty()){
			return list.get(list.size());
		}
		return null;	
	}

	
	public T pop() {
		if (!isEmpty()){
			T temp = list.get(list.size()-1);
			list.remove(list.size()-1);			
			return temp;
		}
		return null;
	}


	public void push(T item) {
		list.add(item);
	}


	public boolean isEmpty() {
		return list.size() == 0;
	}


	public int size() {
		return list.size();
	}

}
